// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   SignBO.java

package com.vandagroup.security;

import com.vandagroup.common.bo.ESSBO;
import com.vandagroup.common.util.Result;
import com.vandagroup.common.util.SQLFormat;
import com.vandagroup.common.util.SQLUtility;
import com.vandagroup.common.util.seqgener.KeyGen;
import java.sql.Date;
import java.sql.SQLException;

// Referenced classes of package com.vandagroup.security:
//            SignPO, SignFormBean

public class SignBO extends ESSBO
{

    SignPO po;
    public static final String STAT_INIT = "0";
    public static final String STAT_SUCC = "1";
    public static final String STAT_FAIL = "2";

    public SignBO()
    {
        po = new SignPO();
    }

    public int add(SignFormBean bean)
        throws SQLException
    {
        bean.setId(new Integer(KeyGen.getKey(po.getTableName())));
        bean.setSignDate(new Date((new java.util.Date()).getTime()));
        bean.setSignStat("0");
        po.setSignForm(bean);
        int rows = po.add();
        return rows;
    }

    public int remove(String ids[])
        throws SQLException
    {
        po.setWhereClause("ID in(" + SQLFormat.joinAsList(ids, false) + ")");
        int rows = po.delete();
        return rows;
    }

    public Result query(int pageNO, SignFormBean bean)
        throws SQLException, Exception
    {
        String whereClause = "";
        Object id = bean.getId();
        whereClause = SQLUtility.addWhereClause(whereClause, "ID", id, false);
        po.setWhereClause(whereClause);
        po.setResultPage(20, pageNO);
        Result result = po.queryResult();
        return result;
    }

    public int update(SignFormBean bean)
        throws SQLException
    {
        po.setWhereClause("ID=" + bean.getId());
        po.setSignForm(bean);
        int rows = po.update();
        return rows;
    }

    public int update(Integer ID, String value)
        throws SQLException
    {
        po.setWhereClause("ID=" + ID);
        po.update("signStat", value);
        return 1;
    }

    public SignFormBean retrieveForm(SignFormBean bean)
        throws SQLException
    {
        po.setWhereClause("ID=" + bean.getId());
        return (SignFormBean)po.retrieveForm();
    }
}
